<!DOCTYPE HTML>
<html>
<head>
	<title>我的个人博客</title>
	<meta charset="utf8">
	<link rel="stylesheet" type="text/css" href="style.css">
	<link rel="icon" type="image/png" href="simbs.png">
</head>
<body>

<div class="top">
	<div class="header"> 
                <div class="logo">
                        <a href="index.php"><img src="logo.png"/></a>
                </div>

		<div id="container">
			<ul>
<?php
	//调用文件CatalogService.class.php
	require_once 'CatalogService.class.php';
	$catalogService = new CatalogService();
	echo $catalogService->navigation();
?>
			</ul>
		</div>
	</div>
	<div class="single">
		<div class="content">
			<?php
				if(!empty($_GET['flag'])) echo "更新完毕";
				
				//取出用户名和密码
				require_once 'AdminService.class.php';
				$admin = new AdminService();
				$arr=$admin->getAdmin();
				$name = $arr[0]["name"];
				$pass = $arr[0]["password"];

				//取出目录名以便修改,返回$row
				require_once 'CatalogService.class.php';
				$catalog = new CatalogService();
				$arr=$catalog->getCatalog();
				$arr1 = $arr[0]["catalog"];
				$arr2 = $arr[1]["catalog"];
				$arr3 = $arr[2]["catalog"];
				$arr4 = $arr[3]["catalog"];
				
			?>
			<form name="changeAdmin" method="post" action="configProcess.php">
			修改用户名或密码<br />
				<?php echo "新用户名<input name='username' type='text' value=$name /><br />"?>
				新的密码<input name="password" type="password" /><br />
				<input name="submit" type="submit" value="确认修改"/>
				<input name="reset" type="reset" value="重新填写"/>
			</form>
			<form name="changeCatalog" method="post" action="configProcess.php">
			您也可以修改导航栏,填入四个栏目名(必须填好四个)<br />
				<?php echo "<input name='catalog[]' type='text' value=$arr1 /><br />" ?>
				<?php echo "<input name='catalog[]' type='text' value=$arr2 /><br />" ?>
				<?php echo "<input name='catalog[]' type='text' value=$arr3 /><br />" ?>
				<?php echo "<input name='catalog[]' type='text' value=$arr4 /><br />" ?>
				<input name="submit" type="submit" value="确认修改"/>
				<input name="reset" type="reset" value="重新填写"/>
			</form>
		</div>
	</div>
	<div class="sidebar">
		<div class="loginSuccess">
			<?php
				session_start();
				if(!empty($_SESSION['name'])){
				echo "当前用户: ".$_SESSION['name']."<br />";
                                echo "<a href='blogList.php'>管理博文</a><br/>";
                                echo "<a href='blogAdd.php'>添加博文</a><br/>";
                                echo "<a href='configManage.php'>管理设置</a><br/>";
				echo "<a href='login.php'>重新登录</a>";
				} else{
				echo "<a href='login.php'>用户登录</a>";
				}
                ?>      

		</div>
                <div class="latest">最近更新
                <ul>
<?php
	//调用文件BlogService.php
	require_once 'BlogService.class.php';
	$blogService = new BlogService();
	echo $blogService->getLatestBlogTitle(10);
?>
                </ul>
        </div>
	</div>
	<div id="footer">
		<p>Copyright &#169;2012 Powered by <a href="http://code.google.com/p/simbs/">simbs</a> </p>
	</div>
</div>
</body>
</html>
